Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
parse-columns
Advanced tools
Parse text columns, like the output of unix commands
$ npm install --save parse-columns
$ df -kP
Filesystem 1024-blocks Used Available Capacity Mounted on
/dev/disk1 487350400 467871060 19223340 97% /
devfs 185 185 0 100% /dev
map -hosts 0 0 0 100% /net
var childProcess = require('child_process');
var parseColumns = require('parse-columns');
childProcess.execFile('df', ['-kP'], function (err, stdout) {
console.log(parseColumns(stdout, {
transform: function (el, header, columnIndex) {
// coerce elements in column index 1 to 3 to a number
if (columnIndex >= 1 && columnIndex <= 3) {
return Number(el);
}
return el;
}
}));
/*
[{
Filesystem: '/dev/disk1',
'1024-blocks': 487350400,
Used: 467528020,
Available: 19566380,
Capacity: '96%',
'Mounted on': '/'
}, ...]
*/
});
Required
Type: string
Text columns to parse.
Type: string
Default: ' '
Separator to split columns on.
Type: array
Headers to use instead of the existing ones.
Type: function
Transform elements.
Useful for being able to cleanup or change the type of elements.
The supplied function gets the following arguments and is expected to return the element:
element
(string)header
(string)columnIndex
(number)rowIndex
(number)MIT © Sindre Sorhus
FAQs
Parse text columns, like the output of Unix commands
The npm package parse-columns receives a total of 27 weekly downloads. As such, parse-columns popularity was classified as not popular.
We found that parse-columns demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.